

#include "helper.h"


bool nsHeaderFixUp::IsInsideMultilineComment(wxString& Line) {
  int EndCommentPos = Line.Find(_T("*/"));
  bool OutsideMultilineComment = false;

  if ( EndCommentPos == wxNOT_FOUND )
    Line.Clear();
  else
  {
    Line.Remove(0,EndCommentPos+2);
    OutsideMultilineComment = true;
  }

  return !OutsideMultilineComment;
}


bool nsHeaderFixUp::IsInsideString(wxString& Line) {
  int EndStringPos = Line.Find(_T('\"'));
  bool OutsideString = false;

  if ( EndStringPos == wxNOT_FOUND )
    Line.Clear();
  else if ( EndStringPos > 0 )
  {
    if ( Line.GetChar(EndStringPos-1) == '\\' )
     
      Line.Remove(0,EndStringPos+1);
    else
      OutsideString = true;
  }
  else
      OutsideString = true;

  if ( OutsideString )
    Line.Remove(0,EndStringPos+1);

  return !OutsideString;
}


bool nsHeaderFixUp::IsNextChar(const wxChar&   NextCharInLine,
                               const wxChar&   ThisChar,
                               const wxString& RemainingLine) {
  wxString s_ChNext = NextCharInLine;
  wxString s_ChComp = ThisChar;      

 
 
  if ( !s_ChNext.IsSameAs(s_ChComp) && !s_ChNext.Trim().IsEmpty() )
  {
   
   
    wxString TrimmedLine(RemainingLine); TrimmedLine.Trim(false);
    if ( !TrimmedLine.IsEmpty() )
      s_ChNext = TrimmedLine.GetChar(0);
  }

  return ( s_ChNext.IsSameAs(s_ChComp) );
}
